//
//  DevListsViewController.m
//  DevOps
//
//  Created by HuCongshi on 15/8/6.
//  Copyright (c) 2015年 HuCongshi. All rights reserved.
//

#import "DevListsViewController.h"

@interface DevListsViewController ()

@property (strong, nonatomic) NSArray *DevLists;

@end

@implementation DevListsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    NSDictionary *Lists = @{@"XXG":@[@"2050",@"3050"],
                            @"TJCloud":@[@"1111",@"1112"],
                            @"NJCloud":@[@"131",@"132",@"133"],
                            @"HH1":@[@"H1",@"H2",@"H3",@"H4"]};
    self.DevLists = Lists[_DevPlaceName];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 3;
    } else{
        return [self.DevLists count];
    }
}
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    NSString *titleName;
    switch (section) {
        case 0:
            titleName = @"机房概况";
            break;
        case 1:
            titleName = @"设备列表";
            break;
        default:
            titleName = @"";
            break;
    }
    return titleName;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        static NSString *cellIdentifer = @"RoomInfoNode";
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer forIndexPath:indexPath];
        NSString *labelText;
        switch (indexPath.row) {
            case 0:
                labelText = @"环境温度:24";
                break;
            case 1:
                labelText = @"相对湿度:25%";
                break;
            case 2:
                labelText = @"xxxx";
                break;
            default:
                break;
        }
        cell.textLabel.text = labelText;
        
        return cell;
        
    } else {
        static NSString *cellIdentifer = @"DevInfoList";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer forIndexPath:indexPath];
        cell.textLabel.text = self.DevLists[indexPath.row];
        return cell;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        return 40.0f;
    } else {
        return 20.0f;
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
